<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学生信息操作</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="app">
        <ul>
            <li v-for="(item,index) in students" :key="item.id">
                姓名：{{item.name}}  年龄：{{item.age}}
                <span @click="change(index)">×</span>
            </li>
        </ul>
    </div>
</body>
<script>
    let vm = new Vue({
        el:"#app",
        data:{
            students:[
                {id:1,name:"小明",age:18},
                {id:2,name:"小红",age:30},
                {id:3,name:"小李",age:22},
                {id:4,name:"小亮",age:25},
                {id:5,name:"小吕",age:28}
            ]
        },
        methods:{
            change(index){
                this.students.splice(index,1)
            }
        }
    })
</script>
</html>